package com.hxci.jfy.controller;


import com.hxci.jfy.dao.StudentjfyDao;
import com.hxci.jfy.pojo.Studentjfy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("stu")
public class StudentjfyController {

    @Autowired
    StudentjfyDao dao;

    @RequestMapping("query")    public String query(Model model){
        List<Studentjfy> list = dao.query();
        model.addAttribute("list", list);
        return "list";
    }

    @RequestMapping("index")
    public String index(){

        return "index";
    }

    @RequestMapping("add")
    public String add(){

        return "add";
    }

    @RequestMapping("save")
    public String save(Studentjfy studentjfy){
        int a =  dao.save(studentjfy);
        return "redirect: query";
    }
    @RequestMapping("delete")
    public String delete(Integer id){
        int a =  dao.delete(id);
        return "redirect: query";
    }
}
